﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace testTennis
{
    class Tournament
    {
        Match match;

        Queue<string> danhsach = new Queue<string>();

        public void addplayer()
        {
            danhsach.Enqueue("P1");
            danhsach.Enqueue("P2");
            danhsach.Enqueue("P3");
            danhsach.Enqueue("P4");
            danhsach.Enqueue("P5");
            danhsach.Enqueue("P6");
            danhsach.Enqueue("P7");
            danhsach.Enqueue("P8");
            danhsach.Enqueue("P9");
            danhsach.Enqueue("P10");
            danhsach.Enqueue("P11");
            danhsach.Enqueue("P12");

        }

        public void playmatch()
        {
            while (danhsach.Count > 1)
            {
                match = new Match();

                match.set.game.P1.setPlayerName(danhsach.Dequeue());
                match.set.game.P2.setPlayerName(danhsach.Dequeue());

                match.playMatch();


                danhsach.Enqueue(match.result);
            }
        }
    }
}
